/*
 * AssignMeterDataBO.java 
 * 
 * Copyright 2009 Wangfeng Beijing Inc. 
 * All rights reserved. 
 * 
 * Created on 2012-07-11
 */
 
package com.bjtech.domain;

import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.ssi.web.struts.bean.BaseBean;

/**
 * 功能概述:分摊数据 <br>
 * @author 王峰
 */
 
public class AssignMeterData extends BaseBean {
	/* */
	private Long id;
	/* */
	private String serious_num;
	/* */
	private Long read_num;
	/* */
	private Date read_time;
	/* */
	private Float back_temp;
	/* */
	private Float from_temp;
	/* */
	private Date record_time;
	/* */
	private Long last_year_num;
	/* */
	private Long january;
	/* */
	private Long february;
	/* */
	private Long march;
	/* */
	private Long april;
	/* */
	private Long may;
	/* */
	private Long october;
	/* */
	private Long november;
	/* */
	private Long december;
	
	private String jzq_num;
	
	private Long file_id;
	
	private static DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	
	public AssignMeterData(){}
	
	/**
	 * 根据抄表数据字符串中解析
	 * 112233445566（集中器号）,002（热分配表号）,000000（当前热值）,2011-05-12 02:03:19（热分配表上传数据时间年月日时分秒）,00（前板温度）,00（后板温度）,

000000（1月热值）,000000（2月热值）,000000（3月热值）,000000（4月热值）,000000（5月热值）,000000（10月热值）,000000（11月热值）,000000（12月热值）,

090000（去年热值）,,2011-05-12 02:03:19（抄表时间年月日时分秒）
	 * @param meterRecord
	 * @throws ParseException 
	 */
	public AssignMeterData(String meterRecord) throws ParseException {
		if(meterRecord.split(",").length==16){
			String[] attrs = meterRecord.split(",");
			this.setJzq_num(String.valueOf(attrs[0]));//集中器号
			this.setSerious_num(String.valueOf(attrs[0])+String.valueOf(attrs[1]));//热分配表号
			this.setRead_num(Long.valueOf(attrs[2]));//当前热值
			//this.setRead_time(parseTime(attrs[3]));//热分配表上传数据时间
			this.setRead_time(format.parse(attrs[3]));//热分配表上传数据时间
			this.setBack_temp(Float.valueOf(attrs[4]));//前板温度
			this.setFrom_temp(Float.valueOf(attrs[5]));//后板温度
			this.setJanuary(Long.valueOf(attrs[6]));//1月
			this.setFebruary(Long.valueOf(attrs[7]));//2月
			this.setMarch(Long.valueOf(attrs[8]));//3月
			this.setApril(Long.valueOf(attrs[9]));//4月
			this.setMay(Long.valueOf(attrs[10]));//5月
			this.setOctober(Long.valueOf(attrs[11]));//10月
			this.setNovember(Long.valueOf(attrs[12]));//11月
			this.setDecember(Long.valueOf(attrs[13]));//12月
			this.setLast_year_num(Long.valueOf(attrs[14]));//去年热值
			//this.setRecord_time(parseTime(attrs[15]));//抄表时间
			this.setRecord_time(format.parse(attrs[15]));//抄表时间
		}
	}
	
	/**
	 * 110512015554（年月日时分秒）
	 * @param string
	 * @return
	 * @throws ParseException 
	 */
	private Date parseTime(String stringDate) throws ParseException {
		String year = "20"+stringDate.substring(0,2);
		String month = stringDate.substring(2,4);
		String day = stringDate.substring(4,6);
		String hour = stringDate.substring(6,8);
		String minute = stringDate.substring(8,10);
		String second = stringDate.substring(10,12);
		
		String temp_date = year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second;
		return format.parse(temp_date);
	}

	public Long getId(){
		return this.id;
	}
	public void setId(Long id){
		this.id = id;
	}
	public String getSerious_num(){
		return this.serious_num;
	}
	public void setSerious_num(String serious_num){
		this.serious_num = serious_num;
	}
	public Long getRead_num(){
		return this.read_num;
	}
	public void setRead_num(Long read_num){
		this.read_num = read_num;
	}
	public Date getRead_time(){
		return this.read_time;
	}
	public void setRead_time(Date read_time){
		this.read_time = read_time;
	}
	public Float getBack_temp(){
		return this.back_temp;
	}
	public void setBack_temp(Float back_temp){
		this.back_temp = back_temp;
	}
	public Float getFrom_temp(){
		return this.from_temp;
	}
	public void setFrom_temp(Float from_temp){
		this.from_temp = from_temp;
	}
	public Date getRecord_time(){
		return this.record_time;
	}
	public void setRecord_time(Date record_time){
		this.record_time = record_time;
	}
	public Long getLast_year_num(){
		return this.last_year_num;
	}
	public void setLast_year_num(Long last_year_num){
		this.last_year_num = last_year_num;
	}
	public Long getJanuary(){
		return this.january;
	}
	public void setJanuary(Long january){
		this.january = january;
	}
	public Long getFebruary(){
		return this.february;
	}
	public void setFebruary(Long february){
		this.february = february;
	}
	public Long getMarch(){
		return this.march;
	}
	public void setMarch(Long march){
		this.march = march;
	}
	public Long getApril(){
		return this.april;
	}
	public void setApril(Long april){
		this.april = april;
	}
	public Long getMay(){
		return this.may;
	}
	public void setMay(Long may){
		this.may = may;
	}
	public Long getOctober(){
		return this.october;
	}
	public void setOctober(Long october){
		this.october = october;
	}
	public Long getNovember(){
		return this.november;
	}
	public void setNovember(Long november){
		this.november = november;
	}
	public Long getDecember(){
		return this.december;
	}
	public void setDecember(Long december){
		this.december = december;
	}
	public String getJzq_num() {
		return jzq_num;
	}
	public void setJzq_num(String jzqNum) {
		jzq_num = jzqNum;
	}
	
	public static void main(String[] args) throws ParseException{
		System.out.println(Long.valueOf("a1",16));
	}

	public Long getFile_id() {
		return file_id;
	}

	public void setFile_id(Long fileId) {
		file_id = fileId;
	}
	
}
